<?php require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
require_once($GLOBALS['PAD']."Modules/FTK9D4D0/modconf.mex");
echo '<script charset="utf-8" type="text/javascript" src="_response/bin.php?get=windconsole.js"></script>
<script charset="utf-8" type="text/javascript" src="_response/bin.php?get=extjs/ext-all-debug.js"></script>
<script charset="utf-8" type="text/javascript" src="_response/bin.php?get=extjs/form-grid.js"></script>';
MYTCONN();
		
	//==========================Vars===========================
	$cb_Banco = 0;
	$Country = 76;
	$Origen0 = null;
	$QOrigen0 = null;
	$Origen1 = null;
	$QOrigen1 = null;
	$Corresponsal = null;
	$QCorresponsal = null;
	$Status = null;
	$QStatus = null;

	$OrderAD1 = 'ASC'; 
	$OrderAD2 = 'ASC'; 
	$OrderAD3 = 'ASC';

	$OrderBy1 = null; 
	$OrderBy2 = null; 
	$OrderBy3 = null;
	
	if(isset($_POST['cb_Banco']) && $_POST['cb_Banco'] != '') {
	$cb_Banco = $_POST['cb_Banco'];
	}
	if(isset($_POST['tdm_Origen0']) && $_POST['tdm_Origen0'] != '') {
	$Origen0 = $_POST['tdm_Origen0'];
	$QOrigen0 = 'AND tdm_Origen0 = '.$Origen0;
	}
	if(isset($_POST['tdm_Origen1']) && $_POST['tdm_Origen1'] != '') {
	$Origen1 = $_POST['tdm_Origen1'];
	$QOrigen1 = 'AND tdm_Origen1 = '.$Origen1;
	}
	if(isset($_POST['tdm_Corresponsal']) && $_POST['tdm_Corresponsal'] != '') {
	$Origen2 = $_POST['tdm_Corresponsal'];
	$QOrigen2 = 'AND tdm_Corresponsal = '.$Corresponsal;
	}
	if(isset($_POST['tdm_Status']) && $_POST['tdm_Status'] != '') {
	$Status = $_POST['tdm_Status'];
	$QStatus = 'AND tdm_Status = '.$Status;
	}
	if(isset($_POST['VIEWColumns'])) { 
		$Colums = $_POST['VIEWColumns'];
		$CCols = count($_POST['VIEWColumns']);
	}
	form_pr('TDMFilters','','','post');	
	mn_field('hidden','ED','tdm_selected','','','','','');
?>
<div id="Filters" class="Line">
	<div style="height:146px;background-color:#F2F2F2">
	<?php  mn_field('hselect','ED','qrDateType',1,"Periodo#1",'','','" style="position:absolute;top:10px;left:10px'); ?>
	<div style="position:absolute;top:10px;left:80px"><?php echo 'De: ';
		mn_field('date','ED','TStart','','TDMFilters','8','','');
		echo ' a: ';
		mn_field('date','ED','TEnd','','TDMFilters','8','',''); ?></div>
    <label style="position:absolute;top:54px;left:10px">Dominio</label>
	<?php
		$Qur = "SELECT dom_ID AS ID, CONCAT(dom_ID,' ',dom_RazonSocial) AS NAME 
		  		FROM dominios WHERE dom_Activo = 1";
		  mn_field('select','ED','tdm_Origen0',$Origen0,$Qur,' ','','" style="width:300px;position:absolute;top:50px;left:80px'); ?>
	<label style="position:absolute;top:94px;left:10px">Corresp.</label>
	<?php
		$Qur = "SELECT CorrNumero AS ID, CorrNombre AS NAME 
		  		FROM corresponsales WHERE CorrActivo = 1";
		  mn_field('select','ED','tdm_Corresponsal',$Corresponsal,$Qur,' ','','" style="width:300px;position:absolute;top:90px;left:80px'); ?>
	<label style="position:absolute;top:134px;left:10px">Canal</label>
	<?php mn_field('hselect','ED','tdm_Modo',1,"Saida;Entrada#1;2",'','','" style="width:300px;position:absolute;top:130px;left:80px'); ?>
	
		<label style="position:absolute;top:48px;left:390px">Corresponsal</label>		<?php mn_field('checkbox','ED','VIEWColumns[]','tdm_Corresponsal','','','','" style="position:absolute;top:46px;left:490px'); ?>
        <label style="position:absolute;top:48px;left:670px">Dominio</label>			<?php mn_field('checkbox','ED','VIEWColumns[]','tdm_Origen0','','','','" style="position:absolute;top:50px;left:790px'); ?>
        <label style="position:absolute;top:66px;left:670px">Canal</label>			<?php mn_field('checkbox','ED','VIEWColumns[]','tdm_Modo','checked','','','" style="position:absolute;top:68px;left:790px'); ?>
        <label style="position:absolute;top:66px;left:520px">Loja</label>			<?php mn_field('checkbox','ED','VIEWColumns[]','tdm_Origen0','','','','" style="position:absolute;top:64px;left:640px'); ?>
        <label style="position:absolute;top:30px;left:670px">Pais</label>			<?php mn_field('checkbox','ED','VIEWColumns[]','tdm_Corresponsal','','','','" style="position:absolute;top:30px;left:790px'); ?>
        <label style="position:absolute;top:48px;left:520px">Estado</label>			<?php mn_field('checkbox','ED','VIEWColumns[]','tdm_Flag','checked','','','" style="position:absolute;top:48px;left:640px'); ?>
        <label style="position:absolute;top:12px;left:820px">Ordenar por:</label><?php 
			  $Qur = 'Operação;Data;Enviado;A pagar;Status;CPF;Banco;Agencia;Tipo Conta#tdm_ID;tdm_FechaIngreso;tdm_Enviado;tdm_ARecibir;tdm_Status;BnfCedula;cb_Banco;cb_Sucursal;cb_TipoCuenta';
			  mn_field('hselect','ED','OrderBy1','',$Qur,'','','" style="position:absolute;top:30px;left:820px');
			  $OrderOps = "DESC;ASC#DESC;ASC";
			  mn_field('hselect','ED','OrderAD1','DESC',$OrderOps,'1','','" style="position:absolute;top:30px;left:898px'); 
			  $Qur = ';Operação;Data;Enviado;A pagar;Status;CPF;Banco;Agencia;Tipo Conta#;tdm_ID;tdm_FechaIngreso;tdm_Enviado;tdm_ARecibir;tdm_Status;BnfCedula;cb_Banco;cb_Sucursal;cb_TipoCuenta';
			  mn_field('hselect','ED','OrderBy2','',$Qur,'','','" style="position:absolute;top:50px;left:820px');
			  mn_field('hselect','ED','OrderAD2','ASC',$OrderOps,'1','','" style="position:absolute;top:50px;left:898px');
			  mn_field('hselect','ED','OrderBy3','',$Qur,'','','" style="position:absolute;top:70px;left:820px');
			  mn_field('hselect','ED','OrderAD3','ASC',$OrderOps,'1','','" style="position:absolute;top:70px;left:898px'); ?>
    
    <?php 
	mn_field('button','ED','TDMSubmit','Consultar','','','','" style="width:100px;position:absolute;top:110px;left:735px" onClick="
	document.TDMFilters.action=\'Modules/FTK9D4D0/Lib/a_05trmdmresults.php\';
	subform(\'TDMFilters\',\'TDMResponse\');'); ?>
	</div>
</div>
</form>
<div id="TDMResponse"></div>